<template>
    <div>
        <div class="conts">
            <div v-for="v in $root.rowlist" class="items"> {{ v }}</div>
            <div style="text-align: center;padding: 200px 0;" v-if="$root.rowlist.length == 0">
                <h1 style="padding: 30px 0;"> - empty - </h1>
                暂无排号信息
            </div>
        </div>
        <div class="rightdownbtn" @click="showflag = 1">
            +
        </div>
        <!-- 弹框 -->
        <div class="fixwrap" v-if="showflag">
            <div class="thewrap" @click.stop=" ">
                <div class="top">
                    添加预约号码
                </div>
                <div style="padding: 30px;text-align: center;">
                    <h1>
                        {{ $root.allnums[$root.lastlength + 1 > 9999 ? 0 : $root.lastlength + 1] }}
                    </h1>
                </div>
                <div class="btns">
                    <span class="btn" v-if="ifsettingflag == 0" @click="addnum">确认</span>
                    <span class="btn" v-if="ifsettingflag == 0" @click="showflag = 0">关闭</span>
                    <span class="btn" v-if="ifsettingflag == 1">处理中...</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    data() {
        return {
            showflag: 0,
            ifsettingflag: 0
        }
    },
    methods: {
        addnum() {
            this.ifsettingflag = 1
            setTimeout(() => {
                this.ifsettingflag = 0
                this.showflag = 0
                this.$root.lastlength = (this.$root.lastlength + 1) > 9999 ? 0 : (this.$root.lastlength + 1)
                this.$root.rowlist.push(this.$root.allnums[this.$root.lastlength])
            }, 3000)
        }
    }
}
</script>

<style scoped>
.rightdownbtn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    line-height: 60px;
    border-radius: 50%;
    background-color: skyblue;
    text-align: center;
    color: white;
    font-size: 40px;
    font-weight: 800;
    cursor: pointer;
}

.fixwrap {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    right: 0;
    line-height: 100vh;
    text-align: center;
    background-color: #000000aa;
    z-index: 3;
}

.thewrap {
    display: inline-block;
    vertical-align: middle;
    width: 80%;
    max-width: 600px;
    height: 300px;
    line-height: normal;
    background-color: white;
    border-radius: 10px;
}

.top {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid #ccc;
}

.btns {
    padding-top: 20px
}

.btns .btn {
    padding: 10px 20px;
    margin: 0 10px;
    background-color: skyblue;
    border: blue;
    color: white;
    border-radius: 5px;
    cursor: pointer;
}

.items {
    margin: 30px;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 0 10px 0 #ccc;
}
</style>